<template>
	<view>
		<page-bg-liner></page-bg-liner>
		<view class="p-l-5 p-r-5 p-t-10 p-b-15 position-rel z-i-10">
			<view class="m-b-5" v-for="(item,index) in list" :key="index">
				<image :src="item" class="imgs" mode="" @tap="$util.previewImg(list,index)"></image>
			</view>
		</view>
		<view class="" style="height: 120upx;"></view>
		<view class="bot-wrap">
			<!-- 保存图片 -->
			<!-- <view class="flex align-center" @click="savePosterPath()">
				<image src="/static/img/download.png" class="share-icon"></image>
			</view> -->
			<!-- 保存pdf -->
			<!-- <view class="flex align-center" @click="downloadPDF()">
				<image src="/static/img/save.png" class="share-icon"></image>pdf
			</view> -->
			<!-- 分享给好友 -->
			<view class="flex align-center" style="position: relative;" @click="share()">
				<image src="/static/img/wx-share.png" class="share-icon"></image>
			</view>
			<!-- 分享给朋友圈 -->
			<view class="flex align-center" style="position: relative;" @click="share()">
				<image src="/static/img/wx-friend.png" class="share-icon"></image>
			</view>
			<!-- 分享给公众好 -->
			<!-- <view class="flex align-center" style="position: relative;">
				<image  src="/static/img/wx.png" class="share-icon"></image>
			</view> -->
		</view>
		
		<view class="mask" v-show="isShowMask" @click="isShowMask = false">
			<view class="flex justify-end" style="margin-top: 60upx;margin-right: 60upx;">
				<view class="" style="color: #fff;margin-top: 50upx;font-size: 34upx;">
					点击右上角更多进行分享~
				</view>
				<image src="/static/img/share1.png" mode="" style="height: 60upx;width: 60upx;"></image>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				titles: 'SOP预览',
				stepId: '', //步骤id
				list: [],
				info: {},
				isShowMask:false
			}
		},
		onLoad() {
			this.stepId = this.getQueryVariable('stepId');
			if (this.stepId) {
				this.getInfo();
			}
		},
		methods: {
			getQueryVariable(variable) {
				var url = window.location.href;
				console.log(url)
				var query = url.split('?')[1];
				console.log(query)
				var vars = query.split("&");
				console.log(vars)
				var str = '';
				for (var i = 0; i < vars.length; i++) {
					var pair = vars[i].split("=");
					if (pair[0] == variable) {
						str = pair[1];
					}
				}
				console.log(str)
				return str;
			},
			getInfo() {
				this.$httpJava('productName/getSopDetails/' + this.stepId, {}, 'get').then(res => {
					if (res.code == 80000) {
						let datas = res.data;
						this.info = datas;
						let list = datas.instructorUrl ? datas.instructorUrl.split(',') : [];
						this.list = list;
					}
				})
			},
			share(){
				this.isShowMask = true
			}

		}
	}
</script>

<style lang="less">
.imgs {
		width: 730upx;
		height: 516upx;
	}

	.bot-wrap {
		width: 100%;
		background: #fff;
		position: fixed;
		bottom: 0;
		left: 0;
		z-index: 99;
		padding: 0 30upx;
		height: 120upx;
		display: flex;
		align-items: center;
		justify-content: space-around;

		.bot-btn {
			width: 100%;
			height: 90upx;
			background: #529EFF;
			opacity: 1;
			border-radius: 20upx;
			font-size: 32upx;
			font-weight: bold;
			color: #fff;
			line-height: 90upx;
			text-align: center;
		}
	}

	.share-icon {
		width: 80upx;
		height: 80upx;
		padding: 10upx 20upx;
	}
	
	.mask{
		position: fixed;
		top: 0;
		z-index: 99999;
		height: 100%;
		width: 100%;
		background-color: #000000;
		opacity: 0.4;
	}
</style>